UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MGUJwuoCsfBHDa5cYliUOsWZLQaVaMn4ovbNyLEXd7w='
WHERE
key_id = 'b6e0f7686de4f34cf197d240cac4abc83ca6b59f1d970e2914d3f6802dcfe124'
AND (
token = 'MGUJwuoCsfBHDa5cYliUOsWZLQaVaMn4ovbNyLEXd7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)