UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lH7UUdSKj2Egtjt0q9MPURd8X4Hesxo3LdaK+DSL7V0='
WHERE
key_id = '6a2d788819fe66c1d15d735627ca1a4dab04c80a7856a926b7b7ca68fb13f910'
AND (
token = 'lH7UUdSKj2Egtjt0q9MPURd8X4Hesxo3LdaK+DSL7V0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)