UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7SNCLXlk0H5FPJln8oJSwHz0vPYpG0BSHo3IQb7R+xo='
WHERE
key_id = '2244ee48f8622a2451985e5ed2483ed77a5637306602dd6ddd888f37eeda3821'
AND (
token = '7SNCLXlk0H5FPJln8oJSwHz0vPYpG0BSHo3IQb7R+xo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)