UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mGTvkmSiYyjKl33W+ea/SqefuTBS8+1c0KeA9enMbfo='
WHERE
key_id = 'c0b19ceb91bdead8ecb7f6ad77c5043bfc6f753e157f354849f414b8c9104887'
AND (
token = 'mGTvkmSiYyjKl33W+ea/SqefuTBS8+1c0KeA9enMbfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)