UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CYnIWPwPTOb+Wia1vWTKA6b4IZvqh+SdNTR06wTU7zg='
WHERE
key_id = 'b9db246c381b846f5e6328723a6d883b50a8d25870bb3750b21da90c071a124e'
AND (
token = 'CYnIWPwPTOb+Wia1vWTKA6b4IZvqh+SdNTR06wTU7zg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)