UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xtgkol4BIwcJGOdWhLsATJ+54T+ZzY2kT15n4mnpYfs=' 
WHERE 
  key_id = 'ae3d159a36415983ecf4fc9a4af1fa972250213487b8d7796a3d3d2bbed23532' 
  AND (
    token = 'Xtgkol4BIwcJGOdWhLsATJ+54T+ZzY2kT15n4mnpYfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035