UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EG6GCDJ2uzk+HHtvml8g6iyrwMxF1VlA2RZ61ZWCQ1A=' 
WHERE 
  key_id = '040dc116d467b2fb5d8486ce0476e72c6d0a0d935015bd5fc125abd66ef2845f' 
  AND (
    token = 'EG6GCDJ2uzk+HHtvml8g6iyrwMxF1VlA2RZ61ZWCQ1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042