UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hSD8ntqq3vfzRNsO7jjSHnBRGxHohptUmGH05SQfl8o=' 
WHERE 
  key_id = 'f23809abbfa32211686faf74b20f567e26ddfb09e91b10aba3dc9903784976d6' 
  AND (
    token = 'hSD8ntqq3vfzRNsO7jjSHnBRGxHohptUmGH05SQfl8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035