UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z428uTZSr+C5l8l4sDs/t8LNBGN3xO2IGtqMoP8KNTQ=' 
WHERE 
  key_id = 'c82c6b7bb5b7e04f74f0c94af1bf8979896c305394fd08410f03c5a45ddb0a4c' 
  AND (
    token = 'z428uTZSr+C5l8l4sDs/t8LNBGN3xO2IGtqMoP8KNTQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048