UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1t799msPPkl69Pmr2M98jcJT3/iDfGySEk3KlFN2EUk='
WHERE
key_id = 'd83daa75541bf8453219cb9d04b30a092a4d4e4f2de6021debbcbbea1a15b678'
AND (
token = '1t799msPPkl69Pmr2M98jcJT3/iDfGySEk3KlFN2EUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)