UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fSNwC9ToJjlE2QbL1MxHAIKEw0ZXB1kVtQMB5EkUWD8=' 
WHERE 
  key_id = '365e83606497c9c459def5e31faeee6fef2b2f688612bd4a8add87a2ef6c5577' 
  AND (
    token = 'fSNwC9ToJjlE2QbL1MxHAIKEw0ZXB1kVtQMB5EkUWD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033