UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6L6sKHF9gZz3nYOtXrGBmPQeEMrepk4hFXVU7XOwDc4='
WHERE
key_id = '8b6a9b3198ad25ffb0671ad4808b162d8c8d553621b365e2ac4a4706a4433c78'
AND (
token = '6L6sKHF9gZz3nYOtXrGBmPQeEMrepk4hFXVU7XOwDc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)