UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KP8RSbrgeis6QpRWmUkIAIALDJRqW7m1tUrjgNajQMc=' 
WHERE 
  key_id = '9707193edc25613f643325374fa94137a89ecec048726183901f65b89b7faae6' 
  AND (
    token = 'KP8RSbrgeis6QpRWmUkIAIALDJRqW7m1tUrjgNajQMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015