UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B3mSCrF83jtrV17/7P8dksh0yb3XJyG1eVCV27nIdJo='
WHERE
key_id = '15cd8582bf4c5c8a0f5a3756f2ee1bfaa0a9720284abfe8af732892fc4d7fa07'
AND (
token = 'B3mSCrF83jtrV17/7P8dksh0yb3XJyG1eVCV27nIdJo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)