UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6pfbHOF5stECus5IsLK5Mqv3kBQlofFyhqn0dan6PVc='
WHERE
key_id = 'c9789d3d1af144fe4ca4d0c778949e350345eadaaa00196f2eddf1430f739adf'
AND (
token = '6pfbHOF5stECus5IsLK5Mqv3kBQlofFyhqn0dan6PVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)