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