UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/HuwpxXGLt8ZfEO+ygKDOih/qySasC8Hd6g+urCj8HI='
WHERE
key_id = 'b8e9e0413886bece455957cfbd50d67c9fa1ea73789159311ced1dec4fc9607c'
AND (
token = '/HuwpxXGLt8ZfEO+ygKDOih/qySasC8Hd6g+urCj8HI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)