UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rMbgEN6j4HdJCTGtczzXnyaLZLKvF4VsRefWFbo2p/s=' 
WHERE 
  key_id = '54832f0f0752448fad8e2d5e63662128932243258c77ec6d1eab62b29148358f' 
  AND (
    token = 'rMbgEN6j4HdJCTGtczzXnyaLZLKvF4VsRefWFbo2p/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022