UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a8Foc95aQJWDeoAb/074ey502oy4dqTLk4dvsW6+LjI=' 
WHERE 
  key_id = 'a501e5f4ab11dcca368db5446456d5ae8fdf7eba35be374f0c0475235467721d' 
  AND (
    token = 'a8Foc95aQJWDeoAb/074ey502oy4dqTLk4dvsW6+LjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032