UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JM8Poexut4S7D00Oj4T+vLvPMR+sVW0lJdsEfqHDg48=' 
WHERE 
  key_id = 'e114ea470ebf8ec2808feb3718ccae45622e0524dc77e5ec71d90248af2cdc4d' 
  AND (
    token = 'JM8Poexut4S7D00Oj4T+vLvPMR+sVW0lJdsEfqHDg48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029