UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G9W2lJf0XGwdaJUut3Fplv8NFw0nrDP+qAa8z8FnJXI='
WHERE
key_id = '96dffe379fc1c1be44158514f6db71993dedcfb9820f17444bfc75b2d7a795dc'
AND (
token = 'G9W2lJf0XGwdaJUut3Fplv8NFw0nrDP+qAa8z8FnJXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)