UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8HDtp5IU2+hIzUDDxBW+vKTC31Ac+rBxS1iQIZ/BbWE=' 
WHERE 
  key_id = 'c96e3551c3fd85165fcf756c4d15328eec51df1ccd223a84e850a95d9b3bc86d' 
  AND (
    token = '8HDtp5IU2+hIzUDDxBW+vKTC31Ac+rBxS1iQIZ/BbWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046