UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fCLrkryA0rnMJkzEOA6CNahtJ+HZ3TOAfUQZSilWCvM=' 
WHERE 
  key_id = '8e9347deed2500137f2c161c3698814e2df2dabd939bb46086af95695a90b034' 
  AND (
    token = 'fCLrkryA0rnMJkzEOA6CNahtJ+HZ3TOAfUQZSilWCvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033