UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bTwNcFAx4cy8GI+zHy7abwppLWJDN0zeSdB8pOwOzNk='
WHERE
key_id = 'da850b65d8266423caa8a36c2180abee8d5a870ba01c5b886201981d541eaba6'
AND (
token = 'bTwNcFAx4cy8GI+zHy7abwppLWJDN0zeSdB8pOwOzNk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)