UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jv38EhgzIgV8tfJ7bitJTWEHcG7x9RoVba71W5H2458=' 
WHERE 
  key_id = '4360f0144bc9656283da53b9b3eda441fbb4c1c382f41739867780c2732922ed' 
  AND (
    token = 'Jv38EhgzIgV8tfJ7bitJTWEHcG7x9RoVba71W5H2458=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041