UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7c8UsWuvxIw+1rcYnhIaQwVxV53gWqFbJV2G7zbchcU='
WHERE
key_id = 'ffbe98c14c0caa933ef599b9f70098a25657fdf540ecea5308ad163897332d35'
AND (
token = '7c8UsWuvxIw+1rcYnhIaQwVxV53gWqFbJV2G7zbchcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)