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

Query time 0.00024