UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xRVe2phgWN88Gse48jOtIPxl3J/o7Kx9tRaTB2AOfgo='
WHERE
key_id = '403e348f45f6c740e7bcf90aee64a7ddc821a3e2bb95830f081a5b0f66adf1a1'
AND (
token = 'xRVe2phgWN88Gse48jOtIPxl3J/o7Kx9tRaTB2AOfgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)