UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q1th4aK0n8Ht15GytdzNOlGnysqaTl6R5MTFY0h394s=' 
WHERE 
  key_id = 'cccf19b599829cea9cb6481e3643c39b12df1f2e9d69bd7ed87f2b0489aeda6e' 
  AND (
    token = 'Q1th4aK0n8Ht15GytdzNOlGnysqaTl6R5MTFY0h394s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023