UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n8sCMSPxp0m1lSVyW8pb4DbLfiugexratQbXySZfQTg='
WHERE
key_id = 'cc9460035830bc32aca393da689e3bae03b4271d56d962d6171983ffde6301f3'
AND (
token = 'n8sCMSPxp0m1lSVyW8pb4DbLfiugexratQbXySZfQTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)