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