UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EKetkkbaIjCiXZIKDF9WOTblTBVLSNGJcLrOzqVhbUs=' 
WHERE 
  key_id = '436c0c88ce8b259e680abf0e31d3822bb953a1a560eedb68e3c9fb9592fb1bca' 
  AND (
    token = 'EKetkkbaIjCiXZIKDF9WOTblTBVLSNGJcLrOzqVhbUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019