UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8AflQ0KqSr+wCtjt0YDOckdhKiz0tdnYD7bxXxSFcT4='
WHERE
key_id = '9f0e4dbb2e26c2687a26277723a20f95a6a4c1b7f88ed82244865376150e215d'
AND (
token = '8AflQ0KqSr+wCtjt0YDOckdhKiz0tdnYD7bxXxSFcT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)