UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pt1pXran/wvtGHePTUU0i3DPKraS+16kATPBdiOpZ8M=' 
WHERE 
  key_id = 'd82abdd55d9d48e39ed61e20d63fac85459d3c89da98d6ef65e4a3da0e35f358' 
  AND (
    token = 'Pt1pXran/wvtGHePTUU0i3DPKraS+16kATPBdiOpZ8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042