UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n5DLw1TQfkzXSdtXQW0FfRkSNSm5hHBKuANvSJ9/r7Q='
WHERE
key_id = 'ac1039a9f540fae1f6fba7f3c567baacf73dd61dc769e313a43c0c1ac6a1acd0'
AND (
token = 'n5DLw1TQfkzXSdtXQW0FfRkSNSm5hHBKuANvSJ9/r7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)