UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YSyg/QXpt0cWmnW6iZrL2+mE+KsMmwHPcI5DKyKfQ1k='
WHERE
key_id = 'c01d07926db22fa7649916927709d9e941255a4dc8af506813bf724595d40fd8'
AND (
token = 'YSyg/QXpt0cWmnW6iZrL2+mE+KsMmwHPcI5DKyKfQ1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)