UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ks27yls0oGJM2xHav6tZM/9Adno0gaaAgdS/iXHGZI8=' 
WHERE 
  key_id = '795bf037d53733e78f3f30d8fc791a16838f191a46fbb443e27abade59e432f7' 
  AND (
    token = 'ks27yls0oGJM2xHav6tZM/9Adno0gaaAgdS/iXHGZI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049