UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6RsUCunnW380eQCYCqMI8JSzK+8CW05rEZk6BYrs94g='
WHERE
key_id = 'f135c48ffd1753663e27a224c813bd36932e9e5e09637b42f64e8519dfbbb71d'
AND (
token = '6RsUCunnW380eQCYCqMI8JSzK+8CW05rEZk6BYrs94g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)