UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oxai0kEQhfIRrS6+LQmVwQ0k431wblBn7IdUyZsCkcU='
WHERE
key_id = 'bf311b40383957a8edea33a323d70705a025e2c850790ac4cdfbf82f2963dc10'
AND (
token = 'oxai0kEQhfIRrS6+LQmVwQ0k431wblBn7IdUyZsCkcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)