UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6TNHIRYJCmkhqceK2UVllucbAR5wKl6BNRB9gAzIsOI=' 
WHERE 
  key_id = '4f9f05a66831a94821a4484d4b76f57b68655d4131cffb1514212dcb47219528' 
  AND (
    token = '6TNHIRYJCmkhqceK2UVllucbAR5wKl6BNRB9gAzIsOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019