UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MhX7im/INPoBSjw3xORtDSgLCqr8mzVAmmVKkc+SlVU='
WHERE
key_id = 'cd02e1f140ebe296b1d962d422bf20a537f2aec70e3ffbc1b3f533fa6e793ad1'
AND (
token = 'MhX7im/INPoBSjw3xORtDSgLCqr8mzVAmmVKkc+SlVU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)