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

Query time 0.00051