UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L7t53sJOZOiCOWYWRLl7w5YpLzI5GuxenrI7G0haKdU=' 
WHERE 
  key_id = '8f882376e5de25bd20d86af62d8f40911621bcf8caf5c4bd23e63621b3245037' 
  AND (
    token = 'L7t53sJOZOiCOWYWRLl7w5YpLzI5GuxenrI7G0haKdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026