UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XyhNP80ZkHR5lWYThi6LPX4S2J0Uk/TfA3r0swT+zV8=' 
WHERE 
  key_id = '4e328b68d38d365e367562bbdeeaa44acee41ba756144ad652c244abea4e5af3' 
  AND (
    token = 'XyhNP80ZkHR5lWYThi6LPX4S2J0Uk/TfA3r0swT+zV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036