UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v1uarnY3jq1DxTQArk3LrSj7bAn6REoqhoyv0w+lmCc='
WHERE
key_id = '7ff212c36e4c4790624062c998be41682799de4e18ccc58d905ca7a909d29f98'
AND (
token = 'v1uarnY3jq1DxTQArk3LrSj7bAn6REoqhoyv0w+lmCc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)