UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yzff//IAUnXYhqhqd8PYzdvmc2X3krT9lEShtSvL2Rc=' 
WHERE 
  key_id = '39b6ad771db3ba2b3e1a94da3505e2699ab78037af7d67e5c59718a8bdbcdac6' 
  AND (
    token = 'Yzff//IAUnXYhqhqd8PYzdvmc2X3krT9lEShtSvL2Rc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040