UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SC1dJBiH616BrfL/S07FviEh6TvnX1o2h9/p21AGeQg='
WHERE
key_id = '9d6998563449489f856798d3e4f84ac0e0a2180d89e5e76a1cbd67194655005a'
AND (
token = 'SC1dJBiH616BrfL/S07FviEh6TvnX1o2h9/p21AGeQg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)